<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../js/vue.js"></script>
</head>
<body>
<div id="app">
    <button @click="num++">增加</button>
    <button @click="decrement">减少</button>
    <h2>
        num = {{num}}
    </h2>
</div>
<script type="javascript">
    var app = new Vue({
        el:"#app",
        data:{
            num:1
        },
        methods: {
            decrement(){//递减
                this.num--;
            }
        }
    });
</script>
</body>
</html>